#ifndef __MAIN_APP
#define __MAIN_APP

#include "Ogre.h"
#include "OgreConfigFile.h"

#include "Logger.h"


using namespace Ogre;


namespace GUI
{
	class DwarfGUI;
}
namespace Graphics
{
	class CopyRenderer;
	class MapRenderer;
	class CreatureManager;
};
namespace DwarfFort
{
	class Interface;
};


namespace Main
{

	class Listener;
	class FileLogListener;

	class App :public Loggable, public Ogre::Singleton<App>
	{
		

		Logger mLogger;
		FileLogListener mLogFile;
		Ogre::Root *mRoot;
		Camera* mCamera;
		SceneManager* mSceneMgr;
		SceneManager* mDFScene;

		RenderWindow* mWindow;

		Main::Listener* mFrameListener;
		Graphics::CopyRenderer *mCopyListener;
		
		Graphics::MapRenderer *mMapRenderer;

		Graphics::CreatureManager *mCreatureManager;

		DwarfFort::Interface *mDwarfFortInterface;
		GUI::DwarfGUI *mGUI;

		
		bool configure(void);
		void chooseSceneManager(void);
		void createCamera(void);
		void createFrameListener(void);
		void createScene(void);
		void destroyScene(void);
		void createViewports(void);
		void setupResources(void);
		void createResourceListener(void);
		void loadResources(void);
		
	public:
		App(void);
		~App(void);

		int Render(void);
		bool Setup();
		

		void MainLoop();


		GUI::DwarfGUI *getGUI() {return mGUI;}
	}; // class App
}; // namespace Main
#endif